home *** CD-ROM | disk | FTP | other *** search
-
-
-
- LGAMMA Mathematical Library Procedures LGAMMA
-
-
-
- NNAAMMEE
- lgamma - log gamma function
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<mmaatthh..hh>>
-
- ddoouubbllee llggaammmmaa((xx))
- ddoouubbllee xx;;
-
- DDEESSCCRRIIPPTTIIOONN
- Lgamma returns ln|I~(x)|.
-
- The external integer signgam returns the sign of I~(x) .
-
- IIDDIIOOSSYYNNCCRRAASSIIEESS
- Do nnoott use the expression signgam*exp(lgamma(x)) to compute
- g := I~(x). Instead use a program like this (in C):
- lg = lgamma(x); g = signgam*exp(lg);
-
- Only after lgamma has returned can signgam be correct. Note
- too that I~(x) must overflow when x is large enough, under-
- flow when -x is large enough, and spawn a division by zero
- when x is a nonpositive integer.
-
- Only in the UNIX math library for C was the name gamma ever
- attached to lnI~. Elsewhere, for instance in IBM's FORTRAN
- library, the name GAMMA belongs to I~ and the name ALGAMA to
- lnI~ in single precision; in double the names are DGAMMA and
- DLGAMA. Why should C be different?
-
- Archaeological records suggest that C's gamma originally
- delivered ln(I~(|x|)). Later, the program gamma was changed
- to cope with negative arguments x in a more conventional
- way, but the documentation did not reflect that change
- correctly. The most recent change corrects inaccurate
- values when x is almost a negative integer, and lets I~(x) be
- computed without conditional expressions. Programmers
- should not assume that lgamma has settled down.
-
- At some time in the future, the name _g_a_m_m_a will be rehabili-
- tated and used for the gamma function, just as is done in
- FORTRAN. The reason for this is not so much compatibility
- with FORTRAN as a desire to achieve greater speed for
- smaller values of |x| and greater accuracy for larger
- values.
-
- Meanwhile, programmers who have to use the name _g_a_m_m_a in its
- former sense, for what is now _l_g_a_m_m_a, have two choices:
-
- 1) Use the old math library, _l_i_b_o_m.
-
- 2) Add the following program to your others:
-
-
-
- Sprite v1.0 May 12, 1986 1
-
-
-
-
-
-
- LGAMMA Mathematical Library Procedures LGAMMA
-
-
-
- ##iinncclluuddee <<mmaatthh..hh>>
- ddoouubbllee ggaammmmaa((xx))
- ddoouubbllee xx;;
- {{
- rreettuurrnn ((llggaammmmaa((xx))));;
- }
-
- DDIIAAGGNNOOSSTTIICCSS
- The reserved operand is returned on a VAX for negative
- integer arguments, _e_r_r_n_o is set to ERANGE; for very large
- arguments over/underflows will occur inside the _l_g_a_m_m_a rou-
- tine.
-
- SSEEEE AALLSSOO
- math(3M), infnan(3M)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 May 12, 1986 2
-
-
-
-